<!--
 * @Author: admin@attacker.club
 * @Date: 2022-07-24 03:19:53
 * @LastEditTime: 2022-07-24 11:22:12
 * @Description: 
-->
<template>
  <el-row :gutter="10">
    <el-col :span="12">
      <el-card class="box-card" >
       <template #header>
      <div class="card-header">
        <span>部署脚本</span>
      </div>
    </template>
     
        <el-form-item label="选择机器:" prop="">
        <el-select
          v-model="ruleForm.host_id"
          multiple
          filterable
          placeholder="选择"
          style="width: 70%"
        >
          <el-option
            v-for="item in ServersOptions"
            :key="item.id"
            :label="item.ip"
            :value="item.id"
          />
        </el-select>
      </el-form-item>
       执行脚本: 

      
   
      </el-card>
    </el-col>

    <el-col :span="12">
        
      <el-card class="box-card" body-style="padding:100px">
          <template #header>
      <div class="card-header">
        <span>执行结果</span>
      </div>
    </template>
        <el-empty description="执行命令以查看日志" />
      </el-card>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: "vueB",
  data() {
    // 自定义效验规则
    const checkNewOldPassword = (rule, value, callback) => {
      if (value != this.Passform.new_password) {
        callback(new Error("两次输入密码不一致！"));
      } else {
        return callback();
      }
    };
    return {
     ruleForm: {
        name: "",
        desc: "",
        env_id: "",
        prod_id: "",
        host_id: '',

      },
      ServersOptions: [],
      formRules: {
        name: [
          { required: true, message: "请输入姓名", trigger: "blur" },
          { min: 2, max: 5, message: "长度在2到5个字符", trigger: "blur" },
        ],
        age: [{ required: true, message: "请输入年龄", trigger: "blur" }],
        sex: [{ required: true, message: "请输入年龄", trigger: "blur" }],
      },
      Passform: {
        new_password: "",
        confirm_password: "",
      },
      PassFormRules: {
        new_password: [
          { required: true, message: "请输入密码", trigger: "blur" },
        ],
        confirm_password: [
          { required: true, message: "请确认新密码", trigger: "blur" },
          { validator: checkNewOldPassword, trigger: "blur" },
        ],
      },
    };
  },
  methods: {
    onSubmit() {
      this.$refs.formRef.validate((valid) => {
        if (valid) {
          // 如果valid为true说明表单效验满足
          console.log(this.form);
        } else {
          console.log("表单格式错误！");
        }
      });
    },
    onRest() {
      this.$refs.formRef.resetFields();
    },
  },
};
</script>

<style scoped>
.logger-empty-container {
  margin-top: 25%;
}
</style>
